package pers.mobian.springfirst.sameBeanName;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @Date 2021/3/6 17:02
 * @Created mobian
 * @Description 测试相同的bean名字，如何区分这两个的注入方式
 */

@Component
public class Test01 {
	@Autowired
	@Qualifier(value = "cat")
	private static Eat eat;


	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-test.xml");

		Eat cat = (Eat) context.getBean("eat");
		System.out.println(cat);
//		cat.eat();
//		eatInterfaceTest();
	}

	public static void eatInterfaceTest() {
		eat.eat();
	}

//	public static void main(String[] args) {
//		AnnotationConfigApplicationContext appConfig = new AnnotationConfigApplicationContext(AppConfig.class);
//		boolean cat = appConfig.isSingleton("cat");
//		System.out.println(cat);
//	}


}
